package com.dhcc.thymeleaf;

import java.util.ArrayList;
import java.util.List;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Bean;
import org.springframework.http.client.ClientHttpRequestFactory;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.client.RestTemplate;
import org.springframework.web.servlet.ModelAndView;

import com.dhcc.thymeleaf.vo.DemoBean;

@Controller
@SpringBootApplication
public class ThymeleafDemo1Application {

	@RequestMapping("/thymeleaf1")
	public ModelAndView thymeleaf1(){

		List<DemoBean> demoBeans = new ArrayList<DemoBean>();
		DemoBean demoBean = new DemoBean();
		demoBean.setName("Java面试必修");
		demoBean.setUrl("www.itmsbx.com");
		demoBeans.add(demoBean);

		demoBean = new DemoBean();
		demoBean.setName("对象无忧");
		demoBean.setUrl("www.51object.com");
		demoBeans.add(demoBean);

		demoBean = new DemoBean();
		demoBean.setName("上海恒骊信息科技");
		demoBean.setUrl("www.henliy.com");
		demoBeans.add(demoBean);

		ModelAndView mav = new ModelAndView("/thymeleaf1");
		mav.addObject("demoBeans",demoBeans);
		mav.addObject("hint","想学习更多面试技巧和知识，请关注公众号：Java面试必修（itmsbx）");
		return mav;
	}
	@RequestMapping("/login")
	public ModelAndView login(){
		DemoBean demoBean = new DemoBean();
		demoBean.setName("Java面试必修");
		demoBean.setUrl("www.itmsbx.com");

		ModelAndView mav = new ModelAndView("/login");
		mav.addObject("demoBean",demoBean);
		mav.addObject("hint","想学习更多面试技巧和知识，请关注公众号：Java面试必修（itmsbx）");
		return mav;
	}
	@Bean
    public RestTemplate restTemplate() {
        return new RestTemplate();
    }
	public static void main(String[] args) {
		SpringApplication.run(ThymeleafDemo1Application.class, args);

	}
}
